
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace Class_RC

Public MustInherit Class _MOV_DETA_PEDIDO
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "MOV_DETA_PEDIDO"
			Me.MappingName = "MOV_DETA_PEDIDO"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_MOV_DETA_PEDIDOLoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal CodMovDetPedido As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_MOV_DETA_PEDIDO.Parameters.CodMovDetPedido, CodMovDetPedido)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_MOV_DETA_PEDIDOLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property CodMovDetPedido As SqlParameter
                Get
                    Return New SqlParameter("@CodMovDetPedido", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodActividad As SqlParameter
                Get
                    Return New SqlParameter("@CodActividad", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodEmpleado As SqlParameter
                Get
                    Return New SqlParameter("@CodEmpleado", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodUsuario As SqlParameter
                Get
                    Return New SqlParameter("@CodUsuario", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Estado As SqlParameter
                Get
                    Return New SqlParameter("@Estado", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property FechaInicio As SqlParameter
                Get
                    Return New SqlParameter("@FechaInicio", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property FechaFinal As SqlParameter
                Get
                    Return New SqlParameter("@FechaFinal", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Observacion As SqlParameter
                Get
                    Return New SqlParameter("@Observacion", SqlDbType.NVarChar, 250)
                End Get
            End Property

            Public Shared ReadOnly Property FechaActualizacion As SqlParameter
                Get
                    Return New SqlParameter("@FechaActualizacion", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodNotaDetalle As SqlParameter
                Get
                    Return New SqlParameter("@CodNotaDetalle", SqlDbType.Int, 0)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const CodMovDetPedido As String = "codMovDetPedido"
            Public Const CodActividad As String = "codActividad"
            Public Const CodEmpleado As String = "codEmpleado"
            Public Const CodUsuario As String = "codUsuario"
            Public Const Estado As String = "estado"
            Public Const FechaInicio As String = "fechaInicio"
            Public Const FechaFinal As String = "fechaFinal"
            Public Const Observacion As String = "observacion"
            Public Const FechaActualizacion As String = "fechaActualizacion"
            Public Const CodNotaDetalle As String = "codNotaDetalle"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodMovDetPedido) = _MOV_DETA_PEDIDO.PropertyNames.CodMovDetPedido
                    ht(CodActividad) = _MOV_DETA_PEDIDO.PropertyNames.CodActividad
                    ht(CodEmpleado) = _MOV_DETA_PEDIDO.PropertyNames.CodEmpleado
                    ht(CodUsuario) = _MOV_DETA_PEDIDO.PropertyNames.CodUsuario
                    ht(Estado) = _MOV_DETA_PEDIDO.PropertyNames.Estado
                    ht(FechaInicio) = _MOV_DETA_PEDIDO.PropertyNames.FechaInicio
                    ht(FechaFinal) = _MOV_DETA_PEDIDO.PropertyNames.FechaFinal
                    ht(Observacion) = _MOV_DETA_PEDIDO.PropertyNames.Observacion
                    ht(FechaActualizacion) = _MOV_DETA_PEDIDO.PropertyNames.FechaActualizacion
                    ht(CodNotaDetalle) = _MOV_DETA_PEDIDO.PropertyNames.CodNotaDetalle

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const CodMovDetPedido As String = "CodMovDetPedido"
            Public Const CodActividad As String = "CodActividad"
            Public Const CodEmpleado As String = "CodEmpleado"
            Public Const CodUsuario As String = "CodUsuario"
            Public Const Estado As String = "Estado"
            Public Const FechaInicio As String = "FechaInicio"
            Public Const FechaFinal As String = "FechaFinal"
            Public Const Observacion As String = "Observacion"
            Public Const FechaActualizacion As String = "FechaActualizacion"
            Public Const CodNotaDetalle As String = "CodNotaDetalle"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodMovDetPedido) = _MOV_DETA_PEDIDO.ColumnNames.CodMovDetPedido
                    ht(CodActividad) = _MOV_DETA_PEDIDO.ColumnNames.CodActividad
                    ht(CodEmpleado) = _MOV_DETA_PEDIDO.ColumnNames.CodEmpleado
                    ht(CodUsuario) = _MOV_DETA_PEDIDO.ColumnNames.CodUsuario
                    ht(Estado) = _MOV_DETA_PEDIDO.ColumnNames.Estado
                    ht(FechaInicio) = _MOV_DETA_PEDIDO.ColumnNames.FechaInicio
                    ht(FechaFinal) = _MOV_DETA_PEDIDO.ColumnNames.FechaFinal
                    ht(Observacion) = _MOV_DETA_PEDIDO.ColumnNames.Observacion
                    ht(FechaActualizacion) = _MOV_DETA_PEDIDO.ColumnNames.FechaActualizacion
                    ht(CodNotaDetalle) = _MOV_DETA_PEDIDO.ColumnNames.CodNotaDetalle

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const CodMovDetPedido As String = "s_CodMovDetPedido"
            Public Const CodActividad As String = "s_CodActividad"
            Public Const CodEmpleado As String = "s_CodEmpleado"
            Public Const CodUsuario As String = "s_CodUsuario"
            Public Const Estado As String = "s_Estado"
            Public Const FechaInicio As String = "s_FechaInicio"
            Public Const FechaFinal As String = "s_FechaFinal"
            Public Const Observacion As String = "s_Observacion"
            Public Const FechaActualizacion As String = "s_FechaActualizacion"
            Public Const CodNotaDetalle As String = "s_CodNotaDetalle"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property CodMovDetPedido As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodMovDetPedido)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodMovDetPedido, Value)
            End Set
        End Property

        Public Overridable Property CodActividad As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodActividad)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodActividad, Value)
            End Set
        End Property

        Public Overridable Property CodEmpleado As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodEmpleado)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodEmpleado, Value)
            End Set
        End Property

        Public Overridable Property CodUsuario As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodUsuario)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodUsuario, Value)
            End Set
        End Property

        Public Overridable Property Estado As String
            Get
                Return MyBase.Getstring(ColumnNames.Estado)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Estado, Value)
            End Set
        End Property

        Public Overridable Property FechaInicio As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.FechaInicio)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.FechaInicio, Value)
            End Set
        End Property

        Public Overridable Property FechaFinal As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.FechaFinal)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.FechaFinal, Value)
            End Set
        End Property

        Public Overridable Property Observacion As String
            Get
                Return MyBase.Getstring(ColumnNames.Observacion)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Observacion, Value)
            End Set
        End Property

        Public Overridable Property FechaActualizacion As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.FechaActualizacion)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.FechaActualizacion, Value)
            End Set
        End Property

        Public Overridable Property CodNotaDetalle As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodNotaDetalle)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodNotaDetalle, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_CodMovDetPedido As String
			Get
				If Me.IsColumnNull(ColumnNames.CodMovDetPedido) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodMovDetPedido)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodMovDetPedido)
				Else
					Me.CodMovDetPedido = MyBase.SetintAsString(ColumnNames.CodMovDetPedido, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodActividad As String
			Get
				If Me.IsColumnNull(ColumnNames.CodActividad) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodActividad)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodActividad)
				Else
					Me.CodActividad = MyBase.SetintAsString(ColumnNames.CodActividad, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodEmpleado As String
			Get
				If Me.IsColumnNull(ColumnNames.CodEmpleado) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodEmpleado)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodEmpleado)
				Else
					Me.CodEmpleado = MyBase.SetintAsString(ColumnNames.CodEmpleado, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodUsuario As String
			Get
				If Me.IsColumnNull(ColumnNames.CodUsuario) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodUsuario)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodUsuario)
				Else
					Me.CodUsuario = MyBase.SetintAsString(ColumnNames.CodUsuario, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Estado As String
			Get
				If Me.IsColumnNull(ColumnNames.Estado) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Estado)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Estado)
				Else
					Me.Estado = MyBase.SetstringAsString(ColumnNames.Estado, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_FechaInicio As String
			Get
				If Me.IsColumnNull(ColumnNames.FechaInicio) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.FechaInicio)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.FechaInicio)
				Else
					Me.FechaInicio = MyBase.SetDateTimeAsString(ColumnNames.FechaInicio, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_FechaFinal As String
			Get
				If Me.IsColumnNull(ColumnNames.FechaFinal) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.FechaFinal)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.FechaFinal)
				Else
					Me.FechaFinal = MyBase.SetDateTimeAsString(ColumnNames.FechaFinal, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Observacion As String
			Get
				If Me.IsColumnNull(ColumnNames.Observacion) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Observacion)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Observacion)
				Else
					Me.Observacion = MyBase.SetstringAsString(ColumnNames.Observacion, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_FechaActualizacion As String
			Get
				If Me.IsColumnNull(ColumnNames.FechaActualizacion) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.FechaActualizacion)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.FechaActualizacion)
				Else
					Me.FechaActualizacion = MyBase.SetDateTimeAsString(ColumnNames.FechaActualizacion, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodNotaDetalle As String
			Get
				If Me.IsColumnNull(ColumnNames.CodNotaDetalle) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodNotaDetalle)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodNotaDetalle)
				Else
					Me.CodNotaDetalle = MyBase.SetintAsString(ColumnNames.CodNotaDetalle, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property CodMovDetPedido() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.CodMovDetPedido, Parameters.CodMovDetPedido)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodActividad() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodActividad, Parameters.CodActividad)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodEmpleado() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodEmpleado, Parameters.CodEmpleado)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodUsuario() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Estado() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Estado, Parameters.Estado)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property FechaInicio() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.FechaInicio, Parameters.FechaInicio)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property FechaFinal() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.FechaFinal, Parameters.FechaFinal)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Observacion() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Observacion, Parameters.Observacion)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property FechaActualizacion() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodNotaDetalle() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodNotaDetalle, Parameters.CodNotaDetalle)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property CodMovDetPedido() As WhereParameter 
			Get
				If _CodMovDetPedido_W Is Nothing Then
					_CodMovDetPedido_W = TearOff.CodMovDetPedido
				End If
				Return _CodMovDetPedido_W
			End Get
		End Property

		Public ReadOnly Property CodActividad() As WhereParameter 
			Get
				If _CodActividad_W Is Nothing Then
					_CodActividad_W = TearOff.CodActividad
				End If
				Return _CodActividad_W
			End Get
		End Property

		Public ReadOnly Property CodEmpleado() As WhereParameter 
			Get
				If _CodEmpleado_W Is Nothing Then
					_CodEmpleado_W = TearOff.CodEmpleado
				End If
				Return _CodEmpleado_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As WhereParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property Estado() As WhereParameter 
			Get
				If _Estado_W Is Nothing Then
					_Estado_W = TearOff.Estado
				End If
				Return _Estado_W
			End Get
		End Property

		Public ReadOnly Property FechaInicio() As WhereParameter 
			Get
				If _FechaInicio_W Is Nothing Then
					_FechaInicio_W = TearOff.FechaInicio
				End If
				Return _FechaInicio_W
			End Get
		End Property

		Public ReadOnly Property FechaFinal() As WhereParameter 
			Get
				If _FechaFinal_W Is Nothing Then
					_FechaFinal_W = TearOff.FechaFinal
				End If
				Return _FechaFinal_W
			End Get
		End Property

		Public ReadOnly Property Observacion() As WhereParameter 
			Get
				If _Observacion_W Is Nothing Then
					_Observacion_W = TearOff.Observacion
				End If
				Return _Observacion_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As WhereParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Public ReadOnly Property CodNotaDetalle() As WhereParameter 
			Get
				If _CodNotaDetalle_W Is Nothing Then
					_CodNotaDetalle_W = TearOff.CodNotaDetalle
				End If
				Return _CodNotaDetalle_W
			End Get
		End Property

		Private _CodMovDetPedido_W As WhereParameter = Nothing
		Private _CodActividad_W As WhereParameter = Nothing
		Private _CodEmpleado_W As WhereParameter = Nothing
		Private _CodUsuario_W As WhereParameter = Nothing
		Private _Estado_W As WhereParameter = Nothing
		Private _FechaInicio_W As WhereParameter = Nothing
		Private _FechaFinal_W As WhereParameter = Nothing
		Private _Observacion_W As WhereParameter = Nothing
		Private _FechaActualizacion_W As WhereParameter = Nothing
		Private _CodNotaDetalle_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_CodMovDetPedido_W = Nothing
			_CodActividad_W = Nothing
			_CodEmpleado_W = Nothing
			_CodUsuario_W = Nothing
			_Estado_W = Nothing
			_FechaInicio_W = Nothing
			_FechaFinal_W = Nothing
			_Observacion_W = Nothing
			_FechaActualizacion_W = Nothing
			_CodNotaDetalle_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property CodMovDetPedido() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodMovDetPedido, Parameters.CodMovDetPedido)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodActividad() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodActividad, Parameters.CodActividad)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodEmpleado() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodEmpleado, Parameters.CodEmpleado)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Estado() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Estado, Parameters.Estado)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FechaInicio() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.FechaInicio, Parameters.FechaInicio)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FechaFinal() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.FechaFinal, Parameters.FechaFinal)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Observacion() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Observacion, Parameters.Observacion)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodNotaDetalle() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodNotaDetalle, Parameters.CodNotaDetalle)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property CodMovDetPedido() As AggregateParameter 
			Get
				If _CodMovDetPedido_W Is Nothing Then
					_CodMovDetPedido_W = TearOff.CodMovDetPedido
				End If
				Return _CodMovDetPedido_W
			End Get
		End Property

		Public ReadOnly Property CodActividad() As AggregateParameter 
			Get
				If _CodActividad_W Is Nothing Then
					_CodActividad_W = TearOff.CodActividad
				End If
				Return _CodActividad_W
			End Get
		End Property

		Public ReadOnly Property CodEmpleado() As AggregateParameter 
			Get
				If _CodEmpleado_W Is Nothing Then
					_CodEmpleado_W = TearOff.CodEmpleado
				End If
				Return _CodEmpleado_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property Estado() As AggregateParameter 
			Get
				If _Estado_W Is Nothing Then
					_Estado_W = TearOff.Estado
				End If
				Return _Estado_W
			End Get
		End Property

		Public ReadOnly Property FechaInicio() As AggregateParameter 
			Get
				If _FechaInicio_W Is Nothing Then
					_FechaInicio_W = TearOff.FechaInicio
				End If
				Return _FechaInicio_W
			End Get
		End Property

		Public ReadOnly Property FechaFinal() As AggregateParameter 
			Get
				If _FechaFinal_W Is Nothing Then
					_FechaFinal_W = TearOff.FechaFinal
				End If
				Return _FechaFinal_W
			End Get
		End Property

		Public ReadOnly Property Observacion() As AggregateParameter 
			Get
				If _Observacion_W Is Nothing Then
					_Observacion_W = TearOff.Observacion
				End If
				Return _Observacion_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Public ReadOnly Property CodNotaDetalle() As AggregateParameter 
			Get
				If _CodNotaDetalle_W Is Nothing Then
					_CodNotaDetalle_W = TearOff.CodNotaDetalle
				End If
				Return _CodNotaDetalle_W
			End Get
		End Property

		Private _CodMovDetPedido_W As AggregateParameter = Nothing
		Private _CodActividad_W As AggregateParameter = Nothing
		Private _CodEmpleado_W As AggregateParameter = Nothing
		Private _CodUsuario_W As AggregateParameter = Nothing
		Private _Estado_W As AggregateParameter = Nothing
		Private _FechaInicio_W As AggregateParameter = Nothing
		Private _FechaFinal_W As AggregateParameter = Nothing
		Private _Observacion_W As AggregateParameter = Nothing
		Private _FechaActualizacion_W As AggregateParameter = Nothing
		Private _CodNotaDetalle_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_CodMovDetPedido_W = Nothing
		_CodActividad_W = Nothing
		_CodEmpleado_W = Nothing
		_CodUsuario_W = Nothing
		_Estado_W = Nothing
		_FechaInicio_W = Nothing
		_FechaFinal_W = Nothing
		_Observacion_W = Nothing
		_FechaActualizacion_W = Nothing
		_CodNotaDetalle_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_MOV_DETA_PEDIDOInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.CodMovDetPedido.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_MOV_DETA_PEDIDOUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_MOV_DETA_PEDIDODelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodMovDetPedido)
		p.SourceColumn = ColumnNames.CodMovDetPedido
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodMovDetPedido)
		p.SourceColumn = ColumnNames.CodMovDetPedido
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodActividad)
		p.SourceColumn = ColumnNames.CodActividad
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodEmpleado)
		p.SourceColumn = ColumnNames.CodEmpleado
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodUsuario)
		p.SourceColumn = ColumnNames.CodUsuario
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Estado)
		p.SourceColumn = ColumnNames.Estado
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.FechaInicio)
		p.SourceColumn = ColumnNames.FechaInicio
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.FechaFinal)
		p.SourceColumn = ColumnNames.FechaFinal
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Observacion)
		p.SourceColumn = ColumnNames.Observacion
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.FechaActualizacion)
		p.SourceColumn = ColumnNames.FechaActualizacion
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodNotaDetalle)
		p.SourceColumn = ColumnNames.CodNotaDetalle
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

